import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useUserStore = defineStore(
  'user',
  () => {
    const name = ref('张三')
    const token = ref('habxhak')
    const getFirstnme = () => {
      const parts = name.value.split('')
      name.value = parts.length > 0 ? parts[0] : ''
    }
    return {
      name,
      token,
      getFirstnme
    }
  },
  {
    persist: true
  }
)
